package com.innovatio.validator.annotations;


import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import static com.innovatio.utils.general.CommonsUtils.EMPTY;
import com.innovatio.validator.handlers.ValidateRequiredHandler;


/**
 * This code is property of Innovatio Software Solutions, Inc.
 * User: Ramon
 * Refactored by:Edxe
 * Date: Mar 3, 2009
 * Time: 7:46:25 PM
 */
@Target(java.lang.annotation.ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Validation(ValidateRequiredHandler.class)
public @interface ValidateRequired {
    /**
     * means that the annotated field will only be required if another field from the same Object is not empty,
     * use case scenario:
     *          if no email address was submitted then any other address is required.
     */
    String ifFieldIsNotEmpty() default EMPTY;

    /**
     * means that the  annotated field will only be require if another field from the same Object is empty.
     * use case scenario:
     *          the age is required if no birth date was submitted;
     */
    String ifFieldIsEmpty() default EMPTY;

    /**
     * the annotated field will be requried if a value from another field from the object is equal to this given value.
     * use case scenario:
     *          a option selected from a drop down will cause some fields to be requried
     */
    String ifFieldValueEquals() default EMPTY;

    String i18nBundleKey() default "validation_required_field_isEmpty";
}